package com.kancy.vip.pattern.proxy.staticproxy;


import com.kancy.vip.pattern.proxy.Person;

/**
 * @author kancy
 * @date 2019/3/16 14:23
 */
public class Father extends Person {
	private Son son;

	public Father(Son son) {
		this.son = son;
	}

	/**
	 * 做为儿子的静态代理，给儿子物色对象，并且按照要求经过一定筛选
	 * @param person
	 * @return
	 */
	@Override
	public boolean findLove(Person person) {
		if(!"女".equalsIgnoreCase(person.getGender())){
			System.out.println("性别不符合要求象：" + person.toString());
			return false;
		}
		if(person.getAge() < 22 || person.getAge() > 30){
			System.out.println("年龄不符合要求象：" + person.toString());
			return false;
		}
		if(person.getHeight() < 165 || person.getAge() > 175){
			System.out.println("升高不符合要求象：" + person.toString());
			return false;
		}
		return son.findLove(person);
	}
}
